//
//  YHIolInfoListCell.m
//  ZhuKuang
//
//  Created by jjkj on 17/7/12.
//  Copyright © 2017年 jjkj. All rights reserved.
//

#import "YHIolInfoListCell.h"

@interface YHIolInfoListCell()
/**车辆类型*/
@property (weak, nonatomic) IBOutlet UILabel *carTypeLabel;
/**异常量*/
@property (weak, nonatomic) IBOutlet UILabel *iolNumLable;
/**报警时间*/
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;


@end

@implementation YHIolInfoListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


/**
 车辆报警赋值

 @param carAlarmIolModel model
 */
-(void)setCarAlarmIolModel:(YHIolInfoListModel *)carAlarmIolModel
{
    self.carTypeLabel.text = carAlarmIolModel.car;
    if (self.type == 2) {
        self.iolNumLable.text = carAlarmIolModel.iolerror;
    }else if (self.type == 3){
        self.iolNumLable.text = [carAlarmIolModel.iolerror stringByAppendingString:@"km/h"];
    }else{
        if ([carAlarmIolModel.iolerror floatValue] != 0) {
           self.iolNumLable.text = [NSString stringWithFormat:@"%.1fL",[carAlarmIolModel.iolerror floatValue]];
        }else{
          self.iolNumLable.text =  @"0L";
        }
    }
    
    NSDate * date = [CommClass dateFormatTimeStamp:carAlarmIolModel.errortime timeFormat:TIME_FORMATTER_24];
    self.timeLabel.text = [CommClass formatTimeStamp:date timeFormat:@"yyyy-MM-dd HH:mm"];
}

/**
 油耗业务赋值

 @param iolErrorModel model
 */
-(void)setIolErrorModel:(ErrorModel *)iolErrorModel
{
   
    self.carTypeLabel.text = iolErrorModel.errorUnit;
    if ([iolErrorModel.iolerror floatValue] > 0) {
        self.iolNumLable.text = [NSString stringWithFormat:@"%.1fL",[iolErrorModel.iolerror floatValue]];
    }else{
        self.iolNumLable.text = @"0L";
    }
    NSDate * date = [CommClass dateFormatTimeStamp:iolErrorModel.errortime timeFormat:TIME_FORMATTER_24];
    self.timeLabel.text = [CommClass formatTimeStamp:date timeFormat:@"yyyy-MM-dd HH:mm"];

}
@end
